#ifndef REMOTE_CONFIG_H
#define REMOTE_CONFIG_H

#include "ApiUrls.h"
#include "Helper.h"
#include "IHTTPClient.h"
#include "cJSON.h"
#include "esp_err.h"
#include "esp_http_client.h"
#include "esp_log.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "led_manager.h"
#include "led_manager_adapter_espidf.h"
#include "nvs.h"
#include "nvs_flash.h"
#include "Profile.h"
#include <inttypes.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>

typedef enum {
	GET_DEVICE_VERSION,
	GET_SERVICE_PROFILE_VERSION,
	PUT_DEVICE_INFO,
	PUT_DEVICE_VERSION
} req_type_t;

typedef struct {
	char *buffer;
	size_t len;
	size_t capacity;
} http_response_t;

typedef struct {
	req_type_t type;
	// 其它上下文数据
	http_response_t resp;
} http_context_t;

class RemoteConfig {
public:
	void monitorRemoteConfigBoot(void);
	char *readDeviceVersion(void);
private:
	void wirteDeviceVersion(const char *version);
	void run(void *arg);
	static void taskWrapper(void *arg);
	char imei[16];
	const char *version;
	IHTTPClient *m_http_client = {};
};

#endif // REMOTE_CONFIG_H
